from django.contrib.auth.models import Group
from rest_framework.viewsets import ModelViewSet
from meiduo_admin.serializers import permission_admin_serializers
from meiduo_admin.my_paginate import MyPageNumberPagination
from users.models import User
from rest_framework.generics import ListAPIView


#1,获取管理员
class PermissionAdminView(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = permission_admin_serializers.PermissionAdminSerializer
    queryset = User.objects.filter(is_superuser=True,is_staff=True).order_by("id")

#2,获取组信息
class PermissionGroupSimpleView(ListAPIView):
    serializer_class = permission_admin_serializers.PermissionGroupSimpleSerializer
    queryset = Group.objects.all()